package com.study.demo_json.controller;

import com.study.demo_json.bean.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @ClassName: UserController
 * @Description:
 * @author: WS
 * @date 2020/12/10
 * @Version: 1.0
 **/
@RestController
public class UserController {
    @GetMapping("/users")
    public List<User> userList(){
        List<User> users=new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            User user=new User();
            user.setId(i);
            user.setAddress("address-->"+i);
            user.setGender(Math.multiplyExact(i,3)%3);
            user.setName("name-->"+i);
            user.setBirthday(new Date());
            users.add(user);
        }
        return users;
    }
}
